import {closeToast, showFailToast, showLoadingToast, showSuccessToast, showToast} from "vant";
/**
 * 提示工具
 */

/**
 * @Note:遮罩层不可以手动关闭
 * @param message
 */
export function loading(message = '请求中...') {
    showLoadingToast({
        message: message,
        forbidClick: false,
    });
}

/**
 * @Note:遮罩层可以手动关闭
 * @param message
 */
export function load(message = '加载中...') {
    showLoadingToast({
        message: message,
        forbidClick: true,
    });
}

/**
 * @Note:弹出提示框
 * @param message
 */
export function alert(message = '') {
    showToast(message);
}

/**
 * @Note:关闭弹出框
 */
export function close() {
    closeToast();
}

/**
 * @Note:成功提示框
 * @param message
 */
export function success(message = "操作成功！") {
    showSuccessToast({
        message: message,
        position: "middle",
        duration: 2000
    });
}

/**
 * @Note:失败提示框
 * @param message
 */
export function fail(message = "网络错误！") {
    showFailToast({
        message: message,
        position: "middle",
        duration: 2000
    });
}
